<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>MyClouds：企业级微服务开源平台</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="keywords" content="MyClouds|微服务开发平台|免费开源框架|Java快速开发框架">
		<meta name="description" content="MyClouds是一个基于SpringBoot/Cloud生态和JavaEE技术栈的企业级微服务开源平台（微服务快速开发框架 & 微服务治理工具集）。支持研发团队快速交付高质量、可扩展的企业分布式微服务应用。">
		<link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="layuiadmin/style/myclouds.css" media="all">
		<link rel="shortcut icon" href="myadmin/img/favicon.ico" />
		<script>
			/^http(s*):\/\//.test(location.href) || alert('请先部署到 localhost 下再访问');
		</script>
	</head>
	<body class="layui-layout-body">

		<div id="LAY_app">
			<div class="layui-layout layui-layout-admin">
				<div class="layui-header">
					<!-- 头部区域 -->
					<ul class="layui-nav layui-layout-left">
						<li class="layui-nav-item layadmin-flexible" lay-unselect>
							<a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
								<i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
							</a>
						</li>
						<li class="layui-nav-item" lay-unselect>
							<a href="javascript:;" layadmin-event="refresh" title="刷新">
								<i class="layui-icon layui-icon-refresh-3"></i>
							</a>
						</li>
						<!--
						<li class="layui-nav-item layui-hide-xs" lay-unselect>
							<a lay-href="home/welcome.html" target="_blank" title="我的工作台">
								<i class="layui-icon layui-icon-home"></i>
							</a>
						</li>
						-->
					</ul>
					<ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
						<!--
						<li class="layui-nav-item" lay-unselect>
							<a lay-href="home/msg.html" layadmin-event="message" lay-text="消息中心">
								<i class="layui-icon layui-icon-notice"></i>
								<span class="layui-badge-dot"></span>
							</a>
						</li>
						-->
						<li class="layui-nav-item layui-hide-xs" lay-unselect>
							<a href="javascript:;" layadmin-event="theme">
								<i class="layui-icon layui-icon-theme"></i>
							</a>
						</li>
						<!--
						<li class="layui-nav-item layui-hide-xs" lay-unselect>
							<a href="javascript:;" layadmin-event="note">
								<i class="layui-icon layui-icon-note"></i>
							</a>
						</li>
						-->
						<li class="layui-nav-item" lay-unselect>
							<a href="javascript:;" layadmin-event="fullscreen">
								<i class="layui-icon layui-icon-screen-full"></i>
							</a>
						</li>
						<li class="layui-nav-item" lay-unselect style="margin-right: 20px;">
							<a href="javascript:;">
								<span id="nav-username"></span>
							</a>
							<dl class="layui-nav-child">
								<dd><a href="javascript:;" id="btn-update-pwd"><i class="layui-icon layui-icon-password"></i>&nbsp;&nbsp;修改密码</a></dd>
								<hr>
								<dd><a href="javascript:;" id="btn-logout"><i class="layui-icon layui-icon-auz"></i>&nbsp;&nbsp;安全退出</a></dd>
							</dl>
						</li>
					</ul>
				</div>

				<!-- 侧边菜单 -->
				<div class="layui-side layui-side-menu">
					<div class="layui-side-scroll">
						<div class="layui-logo" lay-href="views/home/welcome.html">
							<span>MyClouds 微 服 务 平 台</span>
						</div>

						<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">

						</ul>

					</div>
				</div>

				<!-- 页面标签 -->
				<div class="layadmin-pagetabs" id="LAY_app_tabs">
					<div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
					<div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
					<div class="layui-icon layadmin-tabs-control layui-icon-down">
						<ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
							<li class="layui-nav-item" lay-unselect>
								<a href="javascript:;"></a>
								<dl class="layui-nav-child layui-anim-fadein">
									<dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
									<dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
									<dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
								</dl>
							</li>
						</ul>
					</div>
					<div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
						<ul class="layui-tab-title" id="LAY_app_tabsheader">
							<li lay-id="views/home/welcome.html" class="layui-this">欢迎页
							</li>
						</ul>
					</div>
				</div>

				<!-- 主体内容 -->
				<div class="layui-body" id="LAY_app_body">
					<div class="layadmin-tabsbody-item layui-show">
						<iframe src="views/home/welcome.html" frameborder="0" class="layadmin-iframe"></iframe>
					</div>
				</div>

				<!-- 辅助元素，一般用于移动设备下遮罩 -->
				<div class="layadmin-body-shade" layadmin-event="shade"></div>
			</div>
		</div>
	</body>
	<script id="tpl" type="text/html">
		{{# layui.each(d.leftNavMenus, function(index, item){ }}
				{{#  
				  var fnHref = function(url){
					if(url){
						return 'lay-href="' + url + '"';
					}else{
						return '';
					}
				  }; 
				}}
				<li data-name="id-{{ item.id }}" class="layui-nav-item">
					<a href="javascript:;" {{ fnHref(item.url) }} lay-direction="2">
						<i class="{{ item.icon }}"></i>
						<cite>{{ item.label }}</cite>
					</a>
					{{# var children = item.children; layui.each(children, function(index, item){ }}
						{{#  if(index === 0){ }}
						<dl class="layui-nav-child">
						{{#  } }}
							  <dd>
								<a {{ fnHref(item.url) }} >{{ item.label }}</a>
							  </dd>
						{{# if(index === children.length - 1){ }}
						</dl>
						{{#  } }}
					{{# }); }}
				</li>	
			{{# }); }}
	</script>

	<script src="layuiadmin/layui/layui.js"></script>
	<script type="text/javascript">
		layui.config({
			base: 'layuiadmin/' //静态资源所在路径
		}).extend({
			index: 'lib/index' //主入口模块
		}).use(['index', 'myutil', 'laytpl'], function() {
			var $ = layui.$,
				laytpl = layui.laytpl,
				myutil = layui.myutil;
			myutil.init();
			var myuser = myutil.user();
			$('#nav-username').text(myuser && myuser.name);

			//初始化首页框架
			function init() {
				myutil.ajax({
					url: layui.setter.my.surl + 'admin/system/home/init',
					data: {
						userId: myuser.id
					},
					ok: function(res) {
						var data = res.data;
						if (data.leftNavMenus && data.leftNavMenus.length > 0) {
							laytpl($('#tpl').html()).render(data, function(html) {
								$('#LAY-system-side-menu').html(html);
								layui.element.render('nav');
							});
						} else {
							layer.alert('此用户未被授予菜单权限，请联系管理员。', {
								icon: 5
							}, function() {
								logout();
							});
						}
					}
				});
			}
			init();

			//注销事件响应
			$('#btn-logout').on('click', function() {
				layer.confirm('确定注销并退出系统吗？', {
					icon: 3
				}, function(index) {
					myutil.ajax({
						url: layui.setter.my.surl + 'admin/system/auth/logout',
						data: {
							userId: myuser.id,
							token: myuser.token
						},
						ok: function(res) {
							myutil.logout();
						}
					});
				});
			});

			//修改密码
			$('#btn-update-pwd').on('click', function() {
				layer.open({
					type: 2,
					anim: 0,
					isOutAnim: false,
					title: '修改密码',
					content: 'views/home/index-form-pwd.html',
					area: ['500px', '390px'],
					btn: ['确定', '取消'],
					yes: function(index, layero) {
						var submit = layero.find('iframe').contents().find("#btn-submit");
						submit.click();
					},
					success: function(layero, index) {
						var body = layer.getChildFrame('body', index);
						body.find('form [name="id"]').val(myuser.id);
						body.find('form [name="name"]').val(myuser.name);
						body.find('form [name="account"]').val(myuser.account);
					}
				});
			});
		});
	</script>

</html>
